home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
mc51bugs.zip
/
Q31558
< prev
next >
Wrap
Text File
|
1988-07-21
|
1KB
|
38 lines
Q31558 Optimizing for Size Causes Incorrect Code Generation
C Compiler
5.10
MS-DOS
Summary:
You will receive incorrect results when optimizing for size using
the /Os switch in the following example. By generating two different
assembly listings, one with /Ods and the other with /Od, the difference
in the code generated can be seen.
The workaround for this problem is to compile the offending module
without optimizing for size.
This is a known problem in Version 5.10 of the C compiler.
Microsoft is researching this problem and will post new information
as it becomes available.
More Information:
The following code correctly outputs the value 32 as long as size
optimization is not specified. However, when optimizing for size, the
following code incorrectly outputs the value 33:
/* The following aligns something on the next word address boundary */
main()
{
unsigned int alloc_addr;
alloc_addr = 30;
alloc_addr += 2;
alloc_addr = (((((alloc_addr) - 1) >> 1) + 1) << 1);
printf("%u\n",alloc_addr);
}
Keywords: buglist5.10
Updated 88/07/21 03:19